package product_getCategories_request

import (
	"doudian.com/open/sdk_golang/api/product_getCategories/response"
	"doudian.com/open/sdk_golang/core"
	"encoding/json"
)

type ProductGetCategoriesRequest struct {
	doudian_sdk.BaseDoudianOpApiRequest
	Param *ProductGetCategoriesParam 
}
func (c *ProductGetCategoriesRequest) GetUrlPath() string{
	return "/product/getCategories"
}


func New() *ProductGetCategoriesRequest{
	request := &ProductGetCategoriesRequest{
		Param: &ProductGetCategoriesParam{},
	}
	request.SetConfig(doudian_sdk.GlobalConfig)
	request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
	return request

}


func (c *ProductGetCategoriesRequest) Execute(accessToken *doudian_sdk.AccessToken) (*product_getCategories_response.ProductGetCategoriesResponse, error){
	responseJson, err := c.GetClient().Request(c, accessToken)
	if err != nil {
		return nil, err
	}
	response := &product_getCategories_response.ProductGetCategoriesResponse{}
	_ = json.Unmarshal([]byte(responseJson), response)
	return response, nil

}


func (c *ProductGetCategoriesRequest) GetParamObject() interface{}{
	return c.Param
}


func (c *ProductGetCategoriesRequest) GetParams() *ProductGetCategoriesParam{
	return c.Param
}


type ProductGetCategoriesParam struct {
	// 父类目id，传0可以获取一级类目
	Id int64 `json:"id"`
}
